using System.Collections.Generic;

namespace OpenWaves.ActivityFeed.Web.Modules
{
    public class Result
    {
        public static Result Ok()
        {
            return new Result {Status = "ok"};
        }

        public static Result<T> Ok<T>(T value)
        {
            return new Result<T> { Status = "ok", Value = value };
        }

        public static ListResult<TItem> Ok<TItem>(IEnumerable<TItem> list, PaginationStatus paginationStatus)
        {
            return new ListResult<TItem> { Status = "ok", Complete = paginationStatus == PaginationStatus.CompleteResults, Value = list };
        }

        public string Status { get; set; }
    }

    public enum PaginationStatus
    {
        CompleteResults,
        PartialResults
    }

    public class Result<T> : Result
    {       
        public T Value { get; set; } 
    }

    public class ListResult<TItem> : Result<IEnumerable<TItem>>
    {
        public bool Complete { get; set; }
    }
}